﻿{include file="common/header" /}
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="myform">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>WareHouse：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
					<select name="warehouse" id="warehouse" class="select valid">
					  {{volist name="wareHouse" id="vo"}}
                            <option value="{{$vo->location_code}}" {if condition="$data->warehouse eq $vo->location_code"}selected{/if}>{{$vo->name}}</option>
						{{/volist}}
				</select>
				</span>
			</div>
		</div>



		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Name：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->name}}" placeholder="Name" id="name" name="name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Depot：</label>
			<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
					<select name="depot"  id="depot" class="select valid" style="">
					<option value="Home" {if condition="$data->depot eq 'Home'"} selected {/if}>Home</option>
					{{volist name="wareHouse" id="vo"}}
                         <option value="{{$vo->location_code}}" {if condition="$data->depot eq $vo->location_code"}selected{/if}>{{$vo->name}}</option>
					{{/volist}}
				</select>
				</span>
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Max Weight：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->max_weight}}" placeholder="Max Weight" id="max_weight" name="max_weight">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Max Stops：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->max_stops}}" placeholder="Max Stops" id="max_stops" name="max_stops">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>Cold Storage：</label>
			<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
					<select name="is_cold_storage"  id="is_cold_storage" class="select valid" style="">
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>Status：</label>
			<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
					<select name="status"  id="status" class="select valid" style="">
					<option value="1" {if condition="$data->status eq '1'"} selected {/if}>正常</option>
					<option value="0" {if condition="$data->status eq '0'"} selected {/if}>禁用</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<button type="button" class="btn btn-success radius" id="save-btn" name="admin-role-save"><i class="icon-ok"></i> 确定</button>
			</div>
		</div>
		<input type="hidden" name="id" value="{{$data->id}}">
		<input type="hidden" class="input-text" value="{{$data->vehicle_id}}"  id="vehicle_id" name="vehicle_id">
	</form>
</article>
<script>
	$('#save-btn').click(function () {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "{{:url('vehicle/update','',false)}}" ,
            data: $('#myform').serialize(),
            success: function (result) {
                if (result.code == 200) {
                    layer.msg('修改成功!',{icon:1,time:1000},function (index) {
                        parent.getData();
                    });
                }else{
                    layer.msg(result.msg,{icon:1,time:1000});
				}
            },
            error : function() {
                layer.msg('异常!',{icon:1,time:100000000});

            }
        });
    })
</script>
{include file="common/header" /}